Skip to content

[spec-enforcer] Enforce specifications for timeutil, tty, types#29385

Merged
pelikhan merged 1 commit intomainfrom
spec-enforcer/timeutil-tty-types-2026-04-30-ce242aa40a00f061
Apr 30, 2026
Merged

[spec-enforcer] Enforce specifications for timeutil, tty, types#29385
pelikhan merged 1 commit intomainfrom
spec-enforcer/timeutil-tty-types-2026-04-30-ce242aa40a00f061

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Specification Test Enforcement

This PR fixes a specification test error in timeutil and confirms that tty and types are already up to date.

Package Tests Changed Tests Passing Spec Sections Covered
timeutil 1 fixed 4 (FormatDurationNs: zero, negative, 2s, 1m30s) FormatDuration, FormatDurationMs, FormatDurationNs
tty 0 (no changes needed) 3 (existing) IsStdoutTerminal, IsStderrTerminal, DesignDecision
types 0 (no changes needed) 5 (existing) BaseMCPServerConfig, MCPAuthConfig, TokenWeights, TokenClassWeights, ZeroValueSafety

Test Derivation

All tests are derived from README.md specifications, not from implementation source code. Minimal source reads were limited to exact function signatures, import paths, and verifying the fix.

pkg/timeutil

Fixed incorrect SPEC_MISMATCH in TestSpec_PublicAPI_FormatDurationNs.

The prior test commented:

SPEC_MISMATCH: README documents FormatDurationNs(2_500_000_000) → "2s"

But the README actually documents FormatDurationNs(2_000_000_000) → "2s" — a different input. The documented example is entirely correct: 2,000,000,000 nanoseconds = exactly 2 seconds, which time.Duration.Round(time.Second).String() correctly renders as "2s". There is no spec mismatch.

The fix replaces the undocumented 2_500_000_000 → "3s" test (and its misleading comment) with the actual documented example: 2_000_000_000 → "2s".

pkg/tty

No changes needed. The existing spec_test.go covers both documented functions (IsStdoutTerminal, IsStderrTerminal) and the key design decision that both return false in non-TTY environments.

pkg/types

No changes needed. The existing spec_test.go fully covers all four documented types (BaseMCPServerConfig, MCPAuthConfig, TokenWeights, TokenClassWeights), including JSON round-trip validation and zero-value safety.

Spec-Implementation Mismatches

None. The previous apparent mismatch in timeutil was a test error, not an implementation deviation.

Round-Robin State

  • Packages processed this run: timeutil, tty, types
  • Next packages in rotation: typeutil, workflow, actionpins
  • Total eligible packages: 22 (with README.md)

References:

Generated by Package Specification Enforcer · ● 325K ·

  • expires on May 3, 2026, 8:49 PM UTC

…t SPEC_MISMATCH

The previous test claimed the README documented FormatDurationNs(2_500_000_000) → "2s",
but the README actually documents FormatDurationNs(2_000_000_000) → "2s". The documented
example is correct — 2 billion nanoseconds = exactly 2 seconds, rounds to "2s" cleanly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pelikhan pelikhan merged commit f53decc into main Apr 30, 2026
@pelikhan pelikhan deleted the spec-enforcer/timeutil-tty-types-2026-04-30-ce242aa40a00f061 branch April 30, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant